<template>
  <div class="comment-reply">
    <!-- 导航栏 -->
    <van-nav-bar :title="`${comment.reply_count}条回复`">
      <van-icon slot="left" name="cross" />
    </van-nav-bar>
    <!-- 评论单项组件 将此时的comment传过去渲染-->
    <commentItem :comment="comment"></commentItem>
    <van-cell title="全部回复"></van-cell>
    <comment-list :source="comment.com_id" type="c"></comment-list>
    <!-- 发布评论 -->
    <div class="post-wrap">
      <van-button class="post-btn" size="small" round @click="isPostShow = true">写评论</van-button>
    </div>
    <van-popup v-model="isPostShow" position="bottom">
      <CommentPost :target="comment.com_id"></CommentPost>
    </van-popup>
  </div>
</template>

<script>
import commentItem from "@/views/article/components/comment-item";
import CommentList from "./comment-list.vue";
import CommentPost from '@/views/article/components/comment-post'
export default {
  data() {
    return {
      isPostShow: false,
    };
  },
  props: {
    comment: {
      type: Object,
      required: true,
    },
  },
  components: {
    commentItem,
    CommentList,
    CommentPost
  },
};
</script>

<style scoped lang="less">
.scroll-wrap {
  position: fixed;
  top: 92px;
  left: 0;
  right: 0;
  bottom: 88px;
  overflow-y: auto;
}

.post-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  border-top: 1px solid #d8d8d8;
  .post-btn {
    width: 60%;
  }
}
</style>
